import { createRouter, createWebHashHistory } from 'vue-router'
import store from '../store'

const routes = [{
    path: '/',
    name: 'index',
    component: () =>
        import('../views/index.vue')
}]

const router = createRouter({
    history: createWebHashHistory(),
    routes,
    scrollBehavior(to, from, savedPosition) {
        if (savedPosition) {
            return savedPosition
        } else {
            return { top: 0 }
        }
    }
})
router.beforeEach((to, from) => {
    // if (!store.getters.loginStatus && to.name !== 'login') {
    //     return { name: 'login' }
    // }
})
export default router